package com.qf.controller;

import com.qf.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 自动扫描 注解
 * @author lixu
 */
@Controller
public class HelloController {

    @Autowired
    private User user;
    @Autowired
    private RedisTemplate redisTemplate;
   /* @Autowired
    private ElasticsearchRestTemplate elasticsearchRestTemplate;*/

    @GetMapping("/hello")
    @ResponseBody
    public String hello(){


        return "Hello World:" + user;
    }

    /**
     * 访问我们的Hello.html
     */
    @GetMapping("/h")
    public String h(Model model){
        model.addAttribute("hello","大家好我是Thymleaf");
        return "hello";
    }
}
